1373B - 01 Game - CodeForces Solution


games *900

Please click on ads to support us..

Python Code:

t = int(input())
for i in range(t):
    one = 0
    zero = 0 
    s = input()
    n = len(s)
    for j in range(n):
        if s[j] == '1':
            one+=1
        else:
            zero+=1 
    turn = min(zero,one)
    if turn == 0 or turn%2 == 0:
        print("NET")
    else:
        print("DA")

C++ Code:

#include<iostream>
using namespace std;

int main(){
    int t;
    cin>>t;
    while(t--){
    string s;
    cin>>s;
    int n=s.size();
    int cnt0=0,cnt1=0;
    for (int i=0;i<n;i++){
        if (s[i]=='0'){
            cnt0++;

        }
         if (s[i]=='1'){
            cnt1++;
            
        }
    }
    if (min(cnt0,cnt1)%2==0){
        cout<<"NET"<<endl;
    }
    else{
        cout<<"DA"<<endl;
    }
   
    }
return 0;
}


Comments

Submit
0 Comments
More Questions

A. Movement
Numbers in a matrix
Sequences
Split houses
Divisible
Three primes
Coprimes
Cost of balloons
One String No Trouble
Help Jarvis!
Lift queries
Goki and his breakup
Ali and Helping innocent people
Book of Potion making
Duration
Birthday Party
e-maze-in
Bricks Game
Char Sum
Two Strings
Anagrams
Prime Number
Lexical Sorting Reloaded
1514A - Perfectly Imperfect Array
580A- Kefa and First Steps
1472B- Fair Division
996A - Hit the Lottery
MSNSADM1 Football
MATCHES Playing with Matches
HRDSEQ Hard Sequence